<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <input type="password" id="pass" value="12345">
  <input type="button" id="btn" value="点击显示">
  <input type="button" id="arr" value="点击隐藏">
  <script>
    var btn = document.getElementById("btn");
    var pass = document.getElementById("pass")
    var arr = document.getElementById('arr')
    btn.onclick = function () {
      pass.type = "number"
    };
    arr.onclick = function () {
      pass.type = "password"
    }
  </script>
</body>

</html>